package convertTime;

public class Solution {
    public int convertTime(String current, String correct) {
        //
        int currentTime = revToMinitues(current);
        int targetTime = revToMinitues(correct);

        // 贪心
        // 每次都尽可能的选择最大的
        int ans = 0;
        while (currentTime<targetTime) {
            // 60 15 5 1
            if(currentTime+60<=targetTime) {
                currentTime+=60;
            } else if (currentTime+15<=targetTime) {
                currentTime+=15;
            }else if (currentTime+5<=targetTime) {
                currentTime+=5;
            } else {
                currentTime+=1;
            }
            ans++;
        }
        return ans;
    }
    private int revToMinitues(String time) {
        return Integer.parseInt(time.substring(0,2))*60+Integer.parseInt(time.substring(3,5));
    }
}
